package day2;

import java.util.Scanner;

public class StudentManagement2 {
    //学生对象组
    private Student2[] stus;
    //实际学生个数
    private  int counter;


        public void print () {
            //1.程序启动，输出提示文字(由于多次调用它，所有把它封装为函数)
            System.out.println("************************");
            System.out.println("*******学生管理系统*******");
            System.out.println("**+Student Management***");
            System.out.println("************************");
            System.out.println("* 1)Add    增加学生");
            System.out.println("* 2)Delete 删除学生");
            System.out.println("* 3)Update 更新学生");
            System.out.println("* 4)Select 查找学生");
            System.out.println("* 0)Quit 退出系统");
            System.out.println("************************");
            System.out.println("请输入你的选择：");
            System.out.println("Please choose your operate:");
        }
        public void addStudent () {
            int id;
            String name;
            int age;
            String gender;
            Student2 s;
            //判断是否已满
//        if (counter>=stus.length){
//            System.out.println("Add failure,too many student!");
//            //扩容
//            stus = Arrays.copyOf(stus, stus.length * 2);
//            return;
//        }
            Scanner in = new Scanner(System.in);
            System.out.print("Please input id:");
            id = in.nextInt();
            System.out.print("Please input name:");
            name = in.next();
            System.out.print("Please input name:");
            name = in.next();
            System.out.print("Please input age:");
            age = in.nextInt();
            System.out.print("Please input gender:");
            gender = in.next();
            s = new Student2(id, name, age, gender);

            // 关键代码
            stus[counter] = s;
            counter++;
            System.out.println("Add student success!");

    }
}
